import request from '@/utils/request'

import { IArticleparams, Icategoryparams, IlistResponse, Icontentparams } from './types/cms'

// 新增分类
export const addCategory = (params: Icategoryparams) => {
  return request({
    method: 'POST',
    url: '/user/apiExtNewsCategory/save',
    params
  })
}

// 分类列表
export const getCategoryList = (params: {
  shopId: string
}) => {
  return request({
    method: 'POST',
    url: '/user/apiExtNewsCategory/list',
    params
  })
}

// 公告列表
export const getArticleList = (params: {
  id?: number
  page?: number
  pageSize?: number
}) => {
  return request<{
    data: IlistResponse
  }>({
    method: 'POST',
    url: '/user/apiExtNotice/list',
    params
  })
}

// 新增公告
export const addArticle = (params: IArticleparams) => {
  return request({
    method: 'POST',
    url: '/user/apiExtNotice/save',
    params
  })
}

// 删除公告
export const deleteArticle = (params: {
  id: number
}) => {
  return request({
    method: 'POST',
    url: '/user/apiExtNotice/del',
    params
  })
}

// 新增修改文章内容
export const addContent = (params: Icontentparams) => {
  return request({
    method: 'POST',
    url: '/user/apiExtNews/save',
    params
  })
}
